package com.hrt.manage.address.area.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hrt.bean.Area;
import com.hrt.manage.address.area.dao.AreaDao;
import com.hrt.manage.address.area.service.AreaService;
@Service
public class AreaServiceImpl implements AreaService{
	@Autowired
	private AreaDao areaDao;
	@Override
	public Long totalCount() {
		return areaDao.totalCount();
	}

	@Override
	public Area getAreaById(Long id) {
		return areaDao.getById(id);
	}

	@Override
	public void deleteById(Long[] ids) throws Exception {
		List<Area> delResult = areaDao.getByIds(ids);
		for (Area ar : delResult) {
			ar.setIsdelete(new Integer(1));
			areaDao.updateEntity(ar);
		}
		
	}

	@Override
	public void saveArea(Area area) throws Exception {
		areaDao.saveEntity(area);
		
	}

	@Override
	public List queryByPage(int pageIndex, int pageSize) {
		return areaDao.queryByPage(pageIndex, pageSize);
	}

	@Override
	public void updateArea(Area area) {
		areaDao.updateEntity(area);
		
	}

	@Override
	public List<Area> getAreaByCityCode(String citycode) {
		return areaDao.getAreaByCityCode(citycode);
	}

	@Override
	public List queryByPage(String sql, int pageIndex, int pageSize) {
		return areaDao.queryByPage(sql, pageIndex, pageSize);
	}

}
